﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
using Comm100.Domain.Entity;
using Newtonsoft.Json;

namespace Bot.Domain.Entities
{
    [Table("t_Chatbot_Entity_Keyword")]
    public class EntityKeyword
    {
        [Key]             
        public Guid Id { get; set; }
        public Guid EntityId { get; set; }
        public string Content { get; set; }
        public string Synonyms { get; set; }
        [NotMapped]
        public virtual IEnumerable<string> SynonymList
        {
            get
            {
                if (!string.IsNullOrEmpty(Synonyms))
                {
                    return JsonConvert.DeserializeObject<List<string>>(Synonyms);
                }
                return new List<string> { };
            }
        }
    }
}
